package tools.Derby;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class GeneralConnection {
  public GeneralConnection() {

  }
  private Connection con;
  private String url;

  public Connection Setupconnection(String url, String name, String password,String JdbcType) {
     try {
      Class.forName(JdbcType);
      this.url = url;
      this.con = DriverManager.getConnection(url, name, password);
    }
    catch (Exception e) {

    }
    return this.con;
  }
  public boolean closeData(Connection con) {
    this.con = con;
    boolean closed = false;
    try {
      if (!con.isClosed()) {
        con.close();
        closed = true;
      }
      else {
        closed = false;
      }
    }
    catch (SQLException err) {
      System.err.println(err.toString());
    }
    return closed;
  }
}
